'use strict';
angular.module('gkwb')
    .config(['$stateProvider', '$urlRouterProvider', '$httpProvider',function ($stateProvider, $urlRouterProvider, $httpProvider) {
        $httpProvider.defaults.useXDomain = true;
        delete $httpProvider.defaults.headers.common['X-Requested-With'];

        //
        // For any unmatched url, redirect to /state1
        $urlRouterProvider.otherwise("/login");
        //
        // Now set up the states
        $stateProvider
            .state('main', {
                abstract: true,
                url: "/main",
                templateUrl: "pages/main.html"
            })
            .state('main.promise', {
                url: "/promise",
                templateUrl: "pages/main.promise.html",
                controller:'PromiseCtrl'
            })
            .state('main.exam', {
                url: "/exam",
                templateUrl: "pages/main.exam.html",
                controller:'ExamCtrl'
            })
            .state('main.edit', {
                url: "/edit",
                templateUrl: "pages/main.edit.html"
            })
            .state('main.complete', {
                url: "/complete",
                templateUrl: "pages/main.complete.html"
            })
            .state('login', {
                url: "/login",
                templateUrl: "login.html",
                controller:'LoginCtrl'
            })
            .state('modifyPassword', {
                url: "/modifypwd",
                templateUrl: "modifypwd.html",
                params:{pwd:null},
                controller:'modifyPasswordCtrl'
            })
            .state('home', {
                url: "/home",
                abstract: true,
                templateUrl: "pages/home.html"
            })
            /**
            .state('home.pay', {
                url: "/pay",
                templateUrl: "pages/pay.html",
                controller:'PayCtrl'
            })
            */
            .state('home.exam', {
                url: "/exam",
                templateUrl: "pages/home.exam.html",
                controller:'HomeExamCtrl'
            })
            .state('home.edit', {
                url: "/edit",
                templateUrl: "pages/main.exam.html",
                params:{opt:'edit'},
                controller:'ExamCtrl'
            });
    }])